package com.ctshk.rpc.airexpress.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.Objects;

/**
 * 机场快线-销售渠道枚举
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum Channel {
    AUTARKY(1, "自营门市"),
    AGENT(2, "代理商"),
    THIRD_PLATFORM(3, "第三方平台"),
    PLATFORM(4, "官方自营平台"),
    ;

    private Integer id;
    private String name;

    public static Channel getById(int id) {
        return Arrays.stream(Channel.values()).filter(o -> Objects.equals(o.getId(), id)).findFirst().orElse(null);
    }
}
